package com.lmx.repoDomain.tmodel;

import io.katharsis.resource.annotations.JsonApiIncludeByDefault;
import io.katharsis.resource.annotations.JsonApiResource;
import io.katharsis.resource.annotations.JsonApiToOne;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ForeignKey;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

/**
 * 通用类型字典表
 */
@Entity
@JsonApiResource(type = "dicttype")
@Table(name = "t_s_type")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class Dicttype extends BaseDataEntity {

	private String typecode;// 类型编码

	private Typegroup typegroup;// 类型分组

	private String typename;// 类型名称

	private String remark;// 备注

	private Integer sort;// 排序

	private String operateType;// 备注

	@Transient
	public String getOperateType() {
		return operateType;
	}

	public void setOperateType(String operateType) {
		this.operateType = operateType;
	}

	@JsonApiToOne
	@JsonApiIncludeByDefault
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "typegroupid", foreignKey = @ForeignKey(name = "null"))
	@Fetch(FetchMode.JOIN)
	public Typegroup getTypegroup() {
		return typegroup;
	}

	public void setTypegroup(final Typegroup typegroup) {
		this.typegroup = typegroup;
	}

	@Column(name = "typename", length = 50)
	public String getTypename() {
		return typename;
	}

	public void setTypename(final String typename) {
		this.typename = typename;
	}

	@Column(name = "typecode", length = 50)
	public String getTypecode() {
		return typecode;
	}

	public void setTypecode(final String typecode) {
		this.typecode = typecode;
	}

	@Column(name = "remark")
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@Column(name = "sort")
	public Integer getSort() {
		return sort;
	}

	public void setSort(Integer sort) {
		this.sort = sort;
	}
}